<?php $this->_extends('_layouts/projects_layout'); ?>

<?php $this->_block('title'); ?>开源项目|<?php echo $project->category; ?>|<?php echo h($project->title); $this->_endblock(); ?>

<?php $this->_block('contents'); ?>

<!-- 项目详细信息 -->

<div class="project-show">

  <div class="projects-title">
    <img src="<?php echo $_BASE_DIR; ?>qeephp/icn_project.gif" />

    <h1<?php if (!$project->is_approbated): echo ' class="not-approbated"'; endif; ?>>
      <a href="<?php echo url('projects/show', array('name' => $project->name)); ?>"<?php if ($project->is_picked): ?> class="hot"<?php endif; ?>><?php echo h($project->title); ?></a>
      <?php if (!$project->is_approbated): ?><span class="not-approbated">等待审核</span><?php endif; ?>
      <?php if ($project->is_pending_delete): ?><span class="pending-delete">等待删除</span><?php endif; ?>
    </h1>

    <p>
      <?php if (isset($user['id']) && $user['id'] == $project->member_id): ?>
      作者：<?php echo h($project->owner->username); ?>
      , <a href="<?php echo url('projects/edit', array('name' => $project->name)); ?>" class="oper">修改项目</a>
      <?php else: ?>
      作者：<a href="<?php echo url('projects/index', array('type' => 'member', 'key' => $project->owner->username)); ?>"><?php echo h($project->owner->username); ?></a>
      <?php endif; ?>
    </p>
  </div>

  <div class="projects-contents">
    <ul class="meta clearfix">
      <li>分类：<a href="<?php echo url('projects/index', array('type' => 'cat', 'key' => $project->category->slug)); ?>"><?php echo h($project->category->name); ?></a></li>
      <li>最后更新：<strong><?php echo date('Y-m-d H:i', $project->updated); ?></strong></li>
      <li>下载次数：<strong class="hot"><?php echo $project->downloads_count; ?></strong></li>
    </ul>
    
    <ul class="urls">
      <li class="project_url">项目网址：<a href="<?php $url = url('projects/show', array('name' => $project->name)); echo h($url); ?>"><?php echo h($url); ?></a></li>
<?php if ($project->demo_url): ?>
      <li class="demo_url">演示网址：<a href="<?php echo h($project->demo_url); ?>"><?php echo h($project->demo_url); ?></a></li>

<?php endif; ?>

<?php if ($project->doc_url): ?>
      <li class="doc_url">在线文档：<a href="<?php echo h($project->doc_url); ?>"><?php echo h($project->doc_url); ?></a></li>

<?php endif; ?>
    </ul>

    <div class="formatted">
      <?php echo $project->description_formatted; ?>
    </div>

    <hr />
  </div>

<!-- 列出已有的文件 -->

  <a name="list_files"></a>
  <?php if (count($project->files)): ?>

  <div class="projects-files">

    <h2>已上传的文件</h2>

    <ul>

    <?php foreach ($project->files as $file): ?>

      <li>
        说&nbsp;明：<span class="summary"><?php echo h($file->summary); ?></span><br />
        文&nbsp;件：<a class="filename" href="<?php echo url('projects/download', array('name' => $project->name, 'file' => $file->id())); ?>"><?php echo h($file->filename); ?> (<?php printf('%0.2f KB', $file->filesize / 1024); ?>, 上传日期：<?php echo date('Y-m-d H:i', $file->created); ?>)</a><br />
        统&nbsp;计：<span class="stats"><?php $days = intval((time() - $file->created) / 86400); echo $days > 0 ? $days : 1; ?> 天内下载了 <?php echo $file->downloads_count; ?> 次</span>
      </li>
      <li class="empty">&nbsp;</li>

    <?php endforeach; ?>

    </ul>

  </div>

<?php endif; ?>

<!-- /列出已有的文件 -->

</div>

<!-- /项目详细信息 -->

<?php $this->_endblock(); ?>


